/* Copyright 2008. All rights reserved. */
package org.bling.parser.tags;

import org.bling.parser.BlingParserException;
import org.bling.parser.style.StyleParser;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Widget;

/**
 * Configures the SWT Shell
 * 
 * @author DISBROB
 * 
 */
public class BlingTag extends Tag {

	private String height;
	private String width;
	private Shell shell;
	private String style;

	public void setStyle(String style) {
		this.style = style;
	}
	
	public void setHeight(String height) {
		this.height = height;
	}

	public void setWidth(String width) {
		this.width = width;
	}

	@Override
	public int doStartTag() throws BlingParserException {
		super.doStartTag();

		shell = context.getShell();
		shell.setSize(new Integer(width), new Integer(height));
	
		StyleParser.applyStyle((Control) getWidget(), style);
		
		return EVAL_PAGE;
	}

	@Override
	public Widget getWidget() throws BlingParserException {
		return shell;
	}

}
